﻿using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Framework.Logs.Core;
using Pixysoft.Framework.Logs.Controller;
using Pixysoft.TestDrivens;
using Pixysoft.Tools;
using System.IO;

namespace Pixysoft.Framework.Logs.testdriven
{
    class tc_005
    {
        public void test()
        {
            GlobalTimer.Initialize(DateTime.Parse("2010-01-01"));
            string filename = "pixysoft";
            string modulename = "helloworld";
            string id = "000-000-000";

            StringHelper.testdriven_fakeid = true;


            CoreLogger logger = new CoreLogger(filename, modulename);
            try { File.Delete(logger.Setting.GetLogFilename()); }
            catch { }
            logger.Info("helloworld");
            logger.Close();


            ILogReport report = LogReportController.Instance.ParseReport(logger.Setting.GetLogFilename());
            Assert.SaveOrVerify("parse report", report);

            report = LogReportController.Instance.ParseRecentReport(logger.Setting, 0, LogLevel.ALL);
            Assert.SaveOrVerify("recent report", report);

            report = LogReportController.Instance.GetReport(logger.Setting, id, 0);
            Assert.SaveOrVerify("report", report);

            ILogRecord record = LogReportController.Instance.GetRecord(logger.Setting, id, false);
            Assert.SaveOrVerify("record", record);
        }
    }
}
